package org.smartopen.unionpay.openapi.service.dlx;

import org.smartopen.unionpay.openapi.constant.MqConstants;
import org.smartopen.unionpay.openapi.service.IMqService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author ycc
 * @Date 2021-12-09
 */
//监听转发队列，有消息时，把消息转发到目标队列
@Component
public class DLXDelayHandle {

    @Autowired
    private IMqService messageService;

    @RabbitListener(queues = MqConstants.UNIONPAY_REPEAT_TRADE_QUEUE_NAME)
    public void process(DLXMessage message) {
        //此时，才把消息发送到指定队列，而实现延迟功能
        messageService.sendMessage(message.getQueueName(), message.getContent());
    }

}